package com.keba.lamp.complaint.enumeration;


import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;

import java.util.stream.Stream;

@Getter
@AllArgsConstructor
@NoArgsConstructor
@Schema(description = "账户交易类型-枚举")
public enum TransferTypeEnum {

    /**
     * 充值
     */
    RECHARGE("充值",1),
    /**
     * 消费
     */
    CONSUME("消费", 2),
    /**
     * 冲销
     */
    REVERSE("冲销", 3),
    ;



    private String desc;

    private Integer code;

    public static TransferTypeEnum getByCode(Integer code) {

        return Stream.of(TransferTypeEnum.values())
                .filter(p -> p.getCode().equals(code))
                .findAny()
                .orElse(null);
    }
}

